package org.lx.nursing.controller.alter;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.List;
import javax.servlet.http.HttpServletResponse;

import lombok.extern.slf4j.Slf4j;
import org.lx.common.core.domain.R;
import org.lx.nursing.dto.deviceDataDto.HandleAlertDto;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.lx.common.annotation.Log;
import org.lx.common.core.controller.BaseController;
import org.lx.common.core.domain.AjaxResult;
import org.lx.common.enums.BusinessType;
import org.lx.nursing.domain.AlertData;
import org.lx.nursing.service.IAlertDataService;
import org.lx.common.utils.poi.ExcelUtil;
import org.lx.common.core.page.TableDataInfo;

/**
 * 报警数据Controller
 *
 * @author sewen
 * @date 2025-03-12
 */
@RestController
@RequestMapping("/nursing/alertData")
@Api(tags = "报警数据相关接口")
@Slf4j
public class AlertDataController extends BaseController {
    @Autowired
    private IAlertDataService alertDataService;

/**
 * 查询报警数据列表
 */
@PreAuthorize("@ss.hasPermi('nursing:alertData:list')")
@GetMapping("/list")
@ApiOperation("查询报警数据列表")
    public TableDataInfo<List<AlertData>> list(AlertData alertData) {
        startPage();
        List<AlertData> list = alertDataService.selectAlertDataList(alertData);
        return getDataTable(list);
    }

    /**
     * 2.1.2 处理设备报警数据
     * 接口地址:/nursing/alertData/handleAlertData
     * 请求方式:PUT
     */
    @PutMapping("/handleAlertData")
    @ApiOperation("处理设备报警数据")
    public AjaxResult handleAlertData(@RequestBody HandleAlertDto alertData) {
        return toAjax(alertDataService.handleAlertData(alertData.getId(),alertData.getProcessingTime(),alertData.getProcessingResult()));
    }

}
